package com.coder4j.starter.mybatis;

import com.coder4j.starter.tools.util.StringUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * BaseEntity的字段枚举
 *
 * @author Keller
 * @date 2023-08-10 10:09:32
 */
public enum BaseEntityEnums {
    id,
    updateId,
    updateName,
    updateTime,
    createId,
    createName,
    createTime,
    isDeleted;

    private static List<String> fieldList = new ArrayList<>();
    public synchronized static boolean isBaseColumn(String  field){
        if(fieldList.isEmpty()){
            List<String> list = new ArrayList<>();
            for (BaseEntityEnums name : BaseEntityEnums.values()) {
                list.add(StringUtils.humpToLine(name.name()));
            }
            fieldList = list;
        }
        return fieldList.contains(field);
    }
}
